'use strict';

const Controller = require('egg').Controller;

class HomeController extends Controller {
  async index() {
    const { ctx } = this;
    const service = ctx.service;   
    let res = ctx.request.body;
    //测试用
    if (res.group_id == 937681413 || res.user_id == 760523867) {
      // console.log(ctx.request.body);
    }    
    if (res.message == 'test' && res.user_id == 760523867) {
      console.log(res)
      service.sendMsg.sendToGroup({
        id:res.group_id,
        msg:'😅'
      })
      // service.acgImg.acgImg();
    }else if (res.message == '[CQ:at,qq=1544392599] 帮助') {
      service.sendMsg.sendToGroup({
        id:res.group_id,
        msg:`吞吞bot指令集：\n\n①setu：发送随机图（可能有r18）\n②@bot 炸弹：必是r18图\n③@bot 新闻：获取每日新闻\n④@bot 骂我：简简单单骂你一句\n⑤运势：获取今日运势\n⑥回复bot发送的信息 + 撤回：可以撤回bot发的消息\n⑦@bot 查询+宿舍号：查询水电费\n⑧@bot 搜+要搜索的内容：搜索指定图\n⑨发送任何带有bv号的信息：自动解析该视频信息`
      })
    }else if (res.message == 'setu') {
      service.acgImg.acgImg(res);
    }else if (res.message == '[CQ:at,qq=1544392599] 炸弹'){
      service.acgImg.badWomanImg(res);
    }else if (res.message == '[CQ:at,qq=1544392599] 新闻') {
      service.news.sendNews(res);
    }else if (res.message == '[CQ:at,qq=1544392599] 骂我') {
      service.nmsl.getNmsl(res);
    }else if (res.message == '运势'){
      service.suanming.suanming(res);
    }else if (await service.revoc.regular(res)) {
      service.revoc.revocMsg(res);
    }else if (await service.water.regular(res)){
      service.water.waterBal(res);
    }else if (await service.searchImg.regular(res)){
      service.searchImg.searchImg(res);
    }else if (await service.jiexiBv.regular(res)){
      service.jiexiBv.jiexi(res);
    }
    // else if(res.user_id == 1171350230) {
    //   service.sendMsg.sendToGroup({
    //     id:res.group_id,
    //     msg:'😅'
    //   })
    // }
    ctx.body = {};
  }
}

module.exports = HomeController;
